using UnityEngine; using System.Collections; using System.Collections.Generic; namespace UnityEditor.XCodeEditor { public class PBXSortedDictionary : SortedDictionary { public void Append( PBXDictionary dictionary ) { foreach( var item in dictionary) { this.Add( item.Key, item.Value ); } } public void Append( PBXDictionary dictionary ) where T : PBXObject { foreach( var item in dictionary) { this.Add( item.Key, item.Value ); } } } public class PBXSortedDictionary : SortedDictionary where T : PBXObject { public PBXSortedDictionary() { } public PBXSortedDictionary( PBXDictionary genericDictionary ) { foreach( KeyValuePair currentItem in genericDictionary ) { if( ((string)((PBXDictionary)currentItem.Value)[ "isa" ]).CompareTo( typeof(T).Name ) == 0 ) { T instance = (T)System.Activator.CreateInstance( typeof(T), currentItem.Key, (PBXDictionary)currentItem.Value ); this.Add( currentItem.Key, instance ); } } } public void Add( T newObject ) { this.Add( newObject.guid, newObject ); } public void Append( PBXDictionary dictionary ) { foreach( KeyValuePair item in dictionary) { this.Add( item.Key, (T)item.Value ); } } } }